<?php

namespace App\Http\Resources\Mini\WechatFansResource;

use Illuminate\Http\Resources\Json\ResourceCollection;

class PaymentOrderClassCollection extends ResourceCollection
{
    /**
     * Transform the resource into an array.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return array
     */
    public function toArray($request): array
    {
        return [
            'data' => $this->collection->map(function ($item) {
                return [
                    'id' => $item->id,
                    'user_id' => $item->user_id,//用户id
                    'feeType' => $item->feeType,//费用类型
                    'paymentMoney' => $item->paymentMoney,//支付金额
                    'paymentTime' => $item->paymentTime,//支付时间
                    'orderNo' => $item->orderNo,//订单号
                    'pay_type' => $item->pay_type,//支付方式
                    'pay_state' => $item->pay_state,//支付状态
                    'pay_no' => $item->pay_no,//流水单号
                    'pay_real' => $item->pay_real,//实际支付
                    'fatherId' => $item->fatherId,//代理商id
                    'months' => $item->months,//缴费月份
                    'year' => $item->year,//年
                    'month' => $item->month,//月
                    'day' => $item->day,//日
                    'is_split' => $item->is_split,//是否分账
                    'split_money' => $item->split_money,//分账金额
                    'is_auto' => $item->is_auto,//是否自动扣款
                    'is_instead' => $item->is_instead,//1，自交；2，代缴
                    'handlingFee' => $item->handlingFee,//手续费
                    'after_split' => $item->after_split,//分账后金额
                    'after_handling' => $item->after_handling,//去掉手续费金额
                    'device_type' => $item->device_type,//设备类型：1，小程序；2，公众号
                    'openid' => $item->openid,//openid
                    'split_type' => $item->split_type,//分账模式
                    'create_time' => $item->create_time,
                    'update_time' => $item->update_time,
                ];
            }),
        ];
    }
}
